import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Solution1773 {
    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
        Map<String,Integer> map=new HashMap<>();
        map.put("type",0);
        map.put("color",1);
        map.put("name",2);
        int ans=0;
        int k=map.get(ruleKey);
        for (List<String> item : items) {
            if (item.get(k).equals(ruleValue)){
                ans++;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1773().countMatches(Arrays.asList(Arrays.asList("phone","blue","pixel"),Arrays.asList("computer","silver","lenovo"),Arrays.asList("phone","gold","iphone")),"color","silver"));
    }
}
